#include <iostream>
using namespace std;

/*
    继承之后：析构函数的调用规则
       先调用子类的析构函数，再调用父类自己的构造(先子后父)
*/

class Animal
{
public:
    Animal()
    {
        cout << "Animal()" << endl;
    }
    ~Animal()
    {
        cout << "~Animal()" << endl;
    }
};

class Cat : public Animal
{
public:
    Cat()
    {
        cout << "Cat()" << endl;
    }
    ~Cat()
    {
        cout << "~Cat()" << endl;
    }
};

class NaiNiu : public Cat
{
public:
    NaiNiu()
    {
        cout << "NaiNiu()" << endl;
    }
    ~NaiNiu()
    {
        cout << "~NaiNiu()" << endl;
    }
};

int main()
{
    NaiNiu nn;
    return 0;
}